FROM docker.1ms.run/khipu/openjdk17-alpine

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && apk update && apk add busybox-extras

# 设置工作目录
WORKDIR /app

# 将当前目录中的JAR文件复制到镜像中的/app目录
COPY target/HowToCook-BankEnd-1.0.0.jar /app/HowToCook-BankEnd.jar

# 创建配置文件夹
RUN mkdir /app/config

# 暴露应用生成的端口
EXPOSE 8080

# 设置环境变量
ENV logLevel=INFO
# 数据库的环境变量
ENV url=jdbc:mysql://localhost:3306/mock_system?useUnicode=true&characterEncoding=UTF-8&useSSL=false
ENV user=root
ENV pwd=root
ENV lucenePath=/app/data/lucene
ENV uploadPath=/app/data/file

# 创建文件夹
RUN mkdir -p ${lucenePath}
RUN mkdir -p ${uploadPath}


# 定义应用程序的启动命令
ENTRYPOINT ["sh","-c","java -Dspring.datasource.url=${url} -Dspring.datasource.username=${user} -Dspring.datasource.password=${pwd} -Dlucene-path=${lucenePath} -Dupload-path=${uploadPath} -jar HowToCook-BankEnd.jar"]
